package com.artifact.api.controller;

import java.util.ArrayList;
import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import com.artifact.api.entity.City;
import com.artifact.api.entity.Student;
import com.artifact.api.service.StudentService;

@Controller
@RequestMapping("user")
public class UserController {

	@Autowired
	private StudentService studentService;
	
	@RequestMapping("index")
	public String index() {
		System.out.println("******************");
		return "index";
	}
	@RequestMapping("getstudent")
	@ResponseBody
	public List<Object> getUser() {
		List<Object> list = new ArrayList<Object>();
		int id=1;
		Student student = studentService.selectStudentById(id);
		City city= studentService.selectCityById(id);
		list.add(student);
		list.add(city);
		System.out.println(city);
		System.out.println(student);
		return list;
	}
}
